﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Marbles.Core.Content
{
    public static class ContentTypes
    {

        public static string GetIconUrl(string contenttype)
        {
            switch (contenttype.ToLower())
            {
                case "application/envoy": return "/Images/mimetypes/empty.png";
                case "application/fractals": return "/Images/mimetypes/images.png";
                case "application/futuresplash": return "/Images/mimetypes/mime_empty.png";
                case "application/hta": return "/Images/mimetypes/ascii.png";
                case "application/internet-property-stream": return "/Images/mimetypes/binary.png";
                case "application/mac-binhex40": return "/Images/mimetypes/binary.png";
                case "application/msword": return "/Images/mimetypes/document.png";
                case "application/octet-stream": return "/Images/mimetypes/exec_wine.png";
                case "application/oda": return "/Images/mimetypes/binary.png";
                case "application/olescript": return "/Images/mimetypes/binary.png";
                case "application/pdf": return "/Images/mimetypes/pdf.png";
                case "application/pics-rules": return "/Images/mimetypes/ascii.png";
                case "application/pkcs10": return "/Images/mimetypes/ascii.png";
                case "application/pkix-crl": return "/Images/mimetypes/ascii.png";
                case "application/postscript": return "/Images/mimetypes/postscript.png";
                case "application/rtf": return "/Images/mimetypes/document.png";
                case "application/set-payment-initiation": return "/Images/mimetypes/ascii.png";
                case "application/set-registration-initiation": return "/Images/mimetypes/ascii.png";
                case "application/vnd.ms-excel": return "/Images/mimetypes/spreadsheet.png";
                case "application/vnd.ms-outlook": return "/Images/mimetypes/message.png";
                case "application/vnd.ms-pkicertstore": return "/Images/mimetypes/binary.png";
                case "application/vnd.ms-pkiseccat": return "/Images/mimetypes/binary.png";
                case "application/vnd.ms-pkistl": return "/Images/mimetypes/binary.png";
                case "application/vnd.ms-powerpoint": return "/Images/mimetypes/kpresenter_kpr.png";
                case "application/vnd.ms-project": return "/Images/mimetypes/doc.png";
                case "application/vnd.ms-works": return "/Images/mimetypes/doc.png";
                case "application/winhlp": return "/Images/mimetypes/readme.png";
                case "application/x-bcpio": return "/Images/mimetypes/binary.png";
                case "application/x-cdf": return "/Images/mimetypes/binary.png";
                case "application/x-compress": return "/Images/mimetypes/zip.png";
                case "application/x-compressed": return "/Images/mimetypes/zip.png";
                case "application/x-cpio": return "/Images/mimetypes/source_c.png";
                case "application/x-csh": return "/Images/mimetypes/shell1.png";
                case "application/x-director": return "/Images/mimetypes/empty.png";
                case "application/x-dvi": return "/Images/mimetypes/empty.png";
                case "application/x-gtar": return "/Images/mimetypes/zip.png";
                case "application/x-gzip": return "/Images/mimetypes/zip.png";
                case "application/x-hdf": return "/Images/mimetypes/empty.png";
                case "application/x-internet-signup": return "/Images/mimetypes/empty.png";
                case "application/x-iphone": return "/Images/mimetypes/gf.png";
                case "application/x-javascript": return "/Images/mimetypes/source_java.png";
                case "application/x-latex": return "/Images/mimetypes/source.png";
                case "application/x-msaccess": return "/Images/mimetypes/krita_kra.png";
                case "application/x-mscardfile": return "/Images/mimetypes/misc.png";
                case "application/x-msclip": return "/Images/mimetypes/image.png";
                case "application/x-msdownload": return "/Images/mimetypes/binary.png";
                case "application/x-msmediaview": return "/Images/mimetypes/video.png";
                case "application/x-msmetafile": return "/Images/mimetypes/image.png";
                case "application/x-msmoney": return "/Images/mimetypes/kivio_flw.png";
                case "application/x-mspublisher": return "/Images/mimetypes/news.png";
                case "application/x-msschedule": return "/Images/mimetypes/schedule.png";
                case "application/x-msterminal": return "/Images/mimetypes/shell1.png";
                case "application/x-mswrite": return "/Images/mimetypes/doc.png";
                case "application/x-netcdf": return "/Images/mimetypes/man.png";
                case "application/x-perfmon": return "/Images/mimetypes/empty.png";
                case "application/x-pkcs12": return "/Images/mimetypes/encrypted.png";
                case "application/x-pkcs7-certificates": return "/Images/mimetypes/encrypted.png";
                case "application/x-pkcs7-certreqresp": return "/Images/mimetypes/encrypted.png";
                case "application/x-pkcs7-mime": return "/Images/mimetypes/message.png";
                case "application/x-pkcs7-signature": return "/Images/mimetypes/encrypted.png";
                case "application/x-sh": return "/Images/mimetypes/shell1.png";
                case "application/x-shar": return "/Images/mimetypes/zip.png";
                case "application/x-shockwave-flash": return "/Images/mimetypes/swf.png";
                case "application/x-stuffit": return "/Images/mimetypes/zip.png";
                case "application/x-tar": return "/Images/mimetypes/tar.png";
                case "application/x-tcl": return "/Images/mimetypes/source.png";
                case "application/x-tex": return "/Images/mimetypes/tex.png";
                case "application/x-texinfo": return "/Images/mimetypes/tex.png";
                case "application/zip": return "/Images/mimetypes/zip.png";
                case "audio/basic": return "/Images/mimetypes/mime_resource.png";
                case "audio/mid": return "/Images/mimetypes/mime_resource.png";
                case "audio/mpeg": return "/Images/mimetypes/mime_resource.png";
                case "audio/x-aiff": return "/Images/mimetypes/mime_resource.png";
                case "audio/x-mpegurl": return "/Images/mimetypes/mime_resource.png";
                case "audio/x-pn-realaudio": return "/Images/mimetypes/mime_resource.png";
                case "audio/x-wav": return "/Images/mimetypes/mime_resource.png";
                case "image/bmp": return "/Images/mimetypes/image.png";
                case "image/cis-cod": return "/Images/mimetypes/image.png";
                case "image/gif": return "/Images/mimetypes/image.png";
                case "image/ief": return "/Images/mimetypes/image.png";
                case "image/jpeg": return "/Images/mimetypes/image.png";
                case "image/pjpeg": return "/Images/mimetypes/image.png";
                case "image/png": return "/Images/mimetypes/image.png";
                case "image/svg+xml": return "/Images/mimetypes/image.png";
                case "image/tiff": return "/Images/mimetypes/image.png";
                case "image/x-cmu-raster": return "/Images/mimetypes/image.png";
                case "image/x-cmx": return "/Images/mimetypes/image.png";
                case "image/x-icon": return "/Images/mimetypes/image.png";
                case "image/x-portable-anymap": return "/Images/mimetypes/image.png";
                case "image/x-portable-bitmap": return "/Images/mimetypes/image.png";
                case "image/x-portable-graymap": return "/Images/mimetypes/image.png";
                case "image/x-portable-pixmap": return "/Images/mimetypes/image.png";
                case "image/x-rgb": return "/Images/mimetypes/image.png";
                case "image/x-xbitmap": return "/Images/mimetypes/image.png";
                case "image/x-xpixmap": return "/Images/mimetypes/image.png";
                case "image/x-xwindowdump": return "/Images/mimetypes/image.png";
                case "message/rfc822": return "/Images/mimetypes/message.png";
                case "text/css": return "/Images/mimetypes/mime_colorset.png";
                case "text/h323": return "/Images/mimetypes/txt.png";
                case "text/html": return "/Images/mimetypes/html.png";
                case "text/iuls": return "/Images/mimetypes/txt.png";
                case "text/plain": return "/Images/mimetypes/txt.png";
                case "text/richtext": return "/Images/mimetypes/doc.png";
                case "text/scriptlet": return "/Images/mimetypes/source.png";
                case "text/tab-separated-values": return "/Images/mimetypes/txt.png";
                case "text/webviewhtml": return "/Images/mimetypes/html.png";
                case "text/x-component": return "/Images/mimetypes/txt.png";
                case "text/x-setext": return "/Images/mimetypes/txt.png";
                case "text/x-vcard": return "/Images/mimetypes/vcard.png";
                case "video/mpeg": return "/Images/mimetypes/video.png";
                case "video/quicktime": return "/Images/mimetypes/quicktime.png";
                case "video/x-la-asf": return "/Images/mimetypes/video.png";
                case "video/x-ms-asf": return "/Images/mimetypes/video.png";
                case "video/x-msvideo": return "/Images/mimetypes/video.png";
                case "video/x-sgi-movie": return "/Images/mimetypes/video.png";
            }

            return "/Images/mimetypes/unknown.png";
        }

        public static string GetMimeType(string extension)
        {
            switch (extension.ToLower())
            {
                case ".evy": return "application/envoy";
                case ".fif": return "application/fractals";
                case ".spl": return "application/futuresplash";
                case ".hta": return "application/hta";
                case ".acx": return "application/internet-property-stream";
                case ".hqx": return "application/mac-binhex40";
                case ".doc": return "application/msword";
                case ".dot": return "application/msword";
                case ".*": return "application/octet-stream";
                case ".bin": return "application/octet-stream";
                case ".class": return "application/octet-stream";
                case ".dms": return "application/octet-stream";
                case ".exe": return "application/octet-stream";
                case ".lha": return "application/octet-stream";
                case ".lzh": return "application/octet-stream";
                case ".oda": return "application/oda";
                case ".axs": return "application/olescript";
                case ".pdf": return "application/pdf";
                case ".prf": return "application/pics-rules";
                case ".p10": return "application/pkcs10";
                case ".crl": return "application/pkix-crl";
                case ".ai": return "application/postscript";
                case ".eps": return "application/postscript";
                case ".ps": return "application/postscript";
                case ".rtf": return "application/rtf";
                case ".setpay": return "application/set-payment-initiation";
                case ".setreg": return "application/set-registration-initiation";
                case ".xla": return "application/vnd.ms-excel";
                case ".xlc": return "application/vnd.ms-excel";
                case ".xlm": return "application/vnd.ms-excel";
                case ".xls": return "application/vnd.ms-excel";
                case ".xlt": return "application/vnd.ms-excel";
                case ".xlw": return "application/vnd.ms-excel";
                case ".msg": return "application/vnd.ms-outlook";
                case ".sst": return "application/vnd.ms-pkicertstore";
                case ".cat": return "application/vnd.ms-pkiseccat";
                case ".stl": return "application/vnd.ms-pkistl";
                case ".pot": return "application/vnd.ms-powerpoint";
                case ".pps": return "application/vnd.ms-powerpoint";
                case ".ppt": return "application/vnd.ms-powerpoint";
                case ".mpp": return "application/vnd.ms-project";
                case ".wcm": return "application/vnd.ms-works";
                case ".wdb": return "application/vnd.ms-works";
                case ".wks": return "application/vnd.ms-works";
                case ".wps": return "application/vnd.ms-works";
                case ".hlp": return "application/winhlp";
                case ".bcpio": return "application/x-bcpio";
                case ".cdf": return "application/x-cdf";
                case ".z": return "application/x-compress";
                case ".tgz": return "application/x-compressed";
                case ".cpio": return "application/x-cpio";
                case ".csh": return "application/x-csh";
                case ".dcr": return "application/x-director";
                case ".dir": return "application/x-director";
                case ".dxr": return "application/x-director";
                case ".dvi": return "application/x-dvi";
                case ".gtar": return "application/x-gtar";
                case ".gz": return "application/x-gzip";
                case ".hdf": return "application/x-hdf";
                case ".ins": return "application/x-internet-signup";
                case ".isp": return "application/x-internet-signup";
                case ".iii": return "application/x-iphone";
                case ".js": return "application/x-javascript";
                case ".latex": return "application/x-latex";
                case ".mdb": return "application/x-msaccess";
                case ".crd": return "application/x-mscardfile";
                case ".clp": return "application/x-msclip";
                case ".dll": return "application/x-msdownload";
                case ".m13": return "application/x-msmediaview";
                case ".m14": return "application/x-msmediaview";
                case ".mvb": return "application/x-msmediaview";
                case ".wmf": return "application/x-msmetafile";
                case ".mny": return "application/x-msmoney";
                case ".pub": return "application/x-mspublisher";
                case ".scd": return "application/x-msschedule";
                case ".trm": return "application/x-msterminal";
                case ".wri": return "application/x-mswrite";
                case ".nc": return "application/x-netcdf";
                case ".pma": return "application/x-perfmon";
                case ".pmc": return "application/x-perfmon";
                case ".pml": return "application/x-perfmon";
                case ".pmr": return "application/x-perfmon";
                case ".pmw": return "application/x-perfmon";
                case ".p12": return "application/x-pkcs12";
                case ".pfx": return "application/x-pkcs12";
                case ".p7b": return "application/x-pkcs7-certificates";
                case ".spc": return "application/x-pkcs7-certificates";
                case ".p7r": return "application/x-pkcs7-certreqresp";
                case ".p7c": return "application/x-pkcs7-mime";
                case ".p7m": return "application/x-pkcs7-mime";
                case ".p7s": return "application/x-pkcs7-signature";
                case ".sh": return "application/x-sh";
                case ".shar": return "application/x-shar";
                case ".swf": return "application/x-shockwave-flash";
                case ".sit": return "application/x-stuffit";
                case ".sv4cpio": return "application/x-sv4cpio";
                case ".sv4crc": return "application/x-sv4crc";
                case ".tar": return "application/x-tar";
                case ".tcl": return "application/x-tcl";
                case ".tex": return "application/x-tex";
                case ".texi": return "application/x-texinfo";
                case ".texinfo": return "application/x-texinfo";
                case ".roff": return "application/x-troff";
                case ".t": return "application/x-troff";
                case ".tr": return "application/x-troff";
                case ".man": return "application/x-troff-man";
                case ".me": return "application/x-troff-me";
                case ".ms": return "application/x-troff-ms";
                case ".ustar": return "application/x-ustar";
                case ".src": return "application/x-wais-source";
                case ".cer": return "application/x-x509-ca-cert";
                case ".crt": return "application/x-x509-ca-cert";
                case ".der": return "application/x-x509-ca-cert";
                case ".pko": return "application/ynd.ms-pkipko";
                case ".zip": return "application/zip";
                case ".au": return "audio/basic";
                case ".snd": return "audio/basic";
                case ".mid": return "audio/mid";
                case ".rmi": return "audio/mid";
                case ".mp3": return "audio/mpeg";
                case ".aif": return "audio/x-aiff";
                case ".aifc": return "audio/x-aiff";
                case ".aiff": return "audio/x-aiff";
                case ".m3u": return "audio/x-mpegurl";
                case ".ra": return "audio/x-pn-realaudio";
                case ".ram": return "audio/x-pn-realaudio";
                case ".wav": return "audio/x-wav";
                case ".bmp": return "image/bmp";
                case ".cod": return "image/cis-cod";
                case ".gif": return "image/gif";
                case ".ief": return "image/ief";
                case ".jpe": return "image/jpeg";
                case ".jpeg": return "image/jpeg";
                case ".jpg": return "image/jpeg";
                case ".jfif": return "image/pipeg";
                case ".png": return "image/png";
                case ".svg": return "image/svg+xml";
                case ".tif": return "image/tiff";
                case ".tiff": return "image/tiff";
                case ".ras": return "image/x-cmu-raster";
                case ".cmx": return "image/x-cmx";
                case ".ico": return "image/x-icon";
                case ".pnm": return "image/x-portable-anymap";
                case ".pbm": return "image/x-portable-bitmap";
                case ".pgm": return "image/x-portable-graymap";
                case ".ppm": return "image/x-portable-pixmap";
                case ".rgb": return "image/x-rgb";
                case ".xbm": return "image/x-xbitmap";
                case ".xpm": return "image/x-xpixmap";
                case ".xwd": return "image/x-xwindowdump";
                case ".mht": return "message/rfc822";
                case ".mhtml": return "message/rfc822";
                case ".nws": return "message/rfc822";
                case ".css": return "text/css";
                case ".323": return "text/h323";
                case ".htm": return "text/html";
                case ".html": return "text/html";
                case ".stm": return "text/html";
                case ".uls": return "text/iuls";
                case ".bas": return "text/plain";
                case ".c": return "text/plain";
                case ".h": return "text/plain";
                case ".txt": return "text/plain";
                case ".rtx": return "text/richtext";
                case ".sct": return "text/scriptlet";
                case ".tsv": return "text/tab-separated-values";
                case ".htt": return "text/webviewhtml";
                case ".htc": return "text/x-component";
                case ".etx": return "text/x-setext";
                case ".vcf": return "text/x-vcard";
                case ".mp2": return "video/mpeg";
                case ".mpa": return "video/mpeg";
                case ".mpe": return "video/mpeg";
                case ".mpeg": return "video/mpeg";
                case ".mpg": return "video/mpeg";
                case ".mpv2": return "video/mpeg";
                case ".mov": return "video/quicktime";
                case ".qt": return "video/quicktime";
                case ".lsf": return "video/x-la-asf";
                case ".lsx": return "video/x-la-asf";
                case ".asf": return "video/x-ms-asf";
                case ".asr": return "video/x-ms-asf";
                case ".asx": return "video/x-ms-asf";
                case ".avi": return "video/x-msvideo";
                case ".movie": return "video/x-sgi-movie";
                case ".flr": return "x-world/x-vrml";
                case ".vrml": return "x-world/x-vrml";
                case ".wrl": return "x-world/x-vrml";
                case ".wrz": return "x-world/x-vrml";
                case ".xaf": return "x-world/x-vrml";
                case ".xof": return "x-world/x-vrml";
            }

            return "text/plain";
        }
    }
}